<template>
    <el-dialog
      title="提示"
      :visible.sync="visible"
      :show-close="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      width="30%"
      center
    >
      <div class="contentModel">
        <span>当前工序已暂停！</span>
        
      </div>
      <el-button
        type="primary"
        style="font-size: 16px;margin:20px 0 0 350px;"
        @click="suspendStart"
        >开始生产</el-button>
    </el-dialog>
  </template>
  <script>
  import {
    finishInfo
  } from "@/api/apppro/index";
  export default {
    name: "suspend",
    data() {
      return {
        warningType: undefined, // 是否警告
        visible:true,
        //调接口需要的参数
        formObj:{},
        //sn码
        snCode:"",
      };
    },
    // props: {
    //   centerDialogVisible: Boolean,
    //   formObj:Object,
    //   snCode:String,
    // },
    // watch: {
    //   centerDialogVisible: function(val) {
    //     console.log(val,'val');
    //     this.centerDialogVisible = val;
    //     this.visible = this.centerDialogVisible
    //   }
    // },
    created(){
      this.init()
    },
    methods:{
      init(formObj,snCode){
        this.formObj = formObj
        this.snCode = snCode
      },
      suspendStart(){
        this.$modal.confirm("是否确认开始生产？").then(()=>{
          console.log(this.formObj,'子组件的值');
          let params = { ...this.formObj };
          params.snCode = this.snCode;
          finishInfo(params).then(res=>{
            console.log(res,'开始生产res');
            if(res.code == 200){
              this.$modal.msgSuccess(res.msg);
              // this.visible =false
              //让父组件可以点暂停
              this.$emit('myself',false)
            }
          })
        })
        
      },
    }
  };
  </script>
  <style scoped>
  .contentModel {
    color: red;
    font-size: 20px;
    text-align: center;
  }
  
  /deep/ .el-dialog {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0px !important;
  }
  </style>